/*
 * SunSpotHostApplication.java
 *
 * Created on 2012/11/01 10:47:02;
 */
package spotview;

import com.sun.spot.peripheral.radio.RadioFactory;
import com.sun.spot.peripheral.radio.IRadioPolicyManager;
import com.sun.spot.io.j2me.radiostream.*;
import com.sun.spot.io.j2me.radiogram.*;
import com.sun.spot.util.IEEEAddress;
import java.awt.EventQueue;

import java.io.*;
import java.lang.reflect.InvocationTargetException;
import javax.microedition.io.*;

/**
 * Sample Sun SPOT host application
 */
public class SunSpotHostApplication {

    MainFrame frame;
    DeviceHandler device;
    Node node;

    /**
     * Print out our radio address.
     */
    public void run() throws InterruptedException, InvocationTargetException, IOException {
        EventQueue.invokeAndWait(new Runnable() {
            public void run() {
                frame = new MainFrame();
                frame.setVisible(true);
            }
        });
        device = new DeviceHandler(frame);
    }

    /**
     * Start up the host application.
     *
     * @param args any command line arguments
     */
    public static void main(String[] args) {
        SunSpotHostApplication app = new SunSpotHostApplication();
        try {
            app.run();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } catch(InvocationTargetException ex){
            throw new RuntimeException(ex);
        } catch (IOException iex){
            throw new RuntimeException(iex);
        }

    }
}
